package com.demo.testui;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

//方法4 对于自定义的View，可以利用View的绘制流程


public class ActivitySolve4c extends Activity {

    String TAG = Tags.solve4;
    View mView;
    MyView mMyView;
    MyViewGroup mMyViewGroup;
    float percent = Constant.PERCENT_SHOW;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_view_size_exactly);

        //重置自定义的View
//        MyView.percent = Constant.PERCENT_DEFAULT;
//        MyViewGroup.percent = Constant.PERCENT_DEFAULT;

        /**方法4 对于自定义的View，可以利用View的绘制流程**/
        MyView.percent = Constant.PERCENT_SHOW;
        MyViewGroup.percent = Constant.PERCENT_SHOW;



        init();
    }

    private void init() {
        mView = findViewById(R.id.click_area_view);
        mMyView = findViewById(R.id.click_area_myview);
        mMyViewGroup = findViewById(R.id.click_area_myviewgroup);
        mView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(),"View",Toast.LENGTH_SHORT).show();
            }
        });
        mMyView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(),"MyView",Toast.LENGTH_SHORT).show();
            }
        });
        mMyViewGroup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(),"MyViewGroup",Toast.LENGTH_SHORT).show();
            }
        });
    }


}